#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int a[101];
	int b[101]={0};
	int jishu=0;
	int n,m;
	memset(a,0,sizeof(a));
	while(cin>>n>>m){
		if(n==0&&m==0) break;
		if(a[n]==0){
			b[jishu]=n;
			jishu++;
		}
		a[n]=a[n]+m;
	}
	for(int i=0;i<jishu;i++){
		cout<<b[i]<<" "<<a[b[i]]<<endl;
	}
}
